<?php
$id = $_GET['id'];	
switch ($_GET['mod'])
{
	case 'dathang':
		{
	$MaMH=$_GET['id'];	
	$TenMH = $_GET['tenmh'];
	$Gia = $_GET['gia'];
				
	$flag = false;
	foreach ($_SESSION['cart'] as $key => $value) {
		
    	if ($key == $id)
        	$flag = true;
	}

	if ($flag == true) 
	{
    	$_SESSION['cart'][$id]['soluong']++;
    	
	} 
	else 
	{
    	$_SESSION['cart'][$id]['soluong'] = 1;
    	$_SESSION['cart'][$id]['tenmh'] = $TenMH;
   		$_SESSION['cart'][$id]['gia'] = $Gia;
   		
   		
   		
	}
ob_end_clean();
header("location:$_SERVER[HTTP_REFERER]");
break;
		}
	case 'delcart':
		{
			unset($_SESSION['cart'][$id]);
			require 'views/main/cart/cart.php';
			break;
		}
}
?>